<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      for (var i = 0; i < 10; i++) {
        if (i < 3) {
          console.log('广告')
        } else {
          console.log('电视剧')
        }
      }

      // 案例
      var sum = 0
      for (var i = 0; i <= 100; i++) {
        sum += i
      }
      console.log(sum)

      // 1000-2000闰年
      for (var year = 1000; year <= 2000; year++) {
        if (year % 4 === 0) {
          console.log('闰年', year)
          document.write('闰年' + year + '<br>')
        } else {
          console.log('元年', year)
          document.write('元年' + year + '<br>')
        }
      }
    </script>
  </body>
</html>
